home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 108
/
jogo-disk-108.iso
/
Games
/
simple_tower_defense.swf
/
scripts
/
frame_3
/
PlaceObject3_257_235
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2010-05-15
|
4KB
|
137 lines
onClipEvent(enterFrame){
if(_root.go == true)
{
removeMovieClip(this);
}
if(ra.hitTest(_root.en50._x,_root.en50._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en50._x;
oppside = _Y + ba._y - _root.en50._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en51._x,_root.en51._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en51._x;
oppside = _Y + ba._y - _root.en51._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en52._x,_root.en52._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en52._x;
oppside = _Y + ba._y - _root.en52._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en53._x,_root.en53._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en53._x;
oppside = _Y + ba._y - _root.en53._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en54._x,_root.en54._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en54._x;
oppside = _Y + ba._y - _root.en54._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en55._x,_root.en55._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en55._x;
oppside = _Y + ba._y - _root.en55._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en56._x,_root.en56._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en56._x;
oppside = _Y + ba._y - _root.en56._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en57._x,_root.en57._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en57._x;
oppside = _Y + ba._y - _root.en57._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en58._x,_root.en58._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en58._x;
oppside = _Y + ba._y - _root.en58._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
else if(ra.hitTest(_root.en59._x,_root.en59._y,true))
{
inrange = true;
adjside = _X + ba._x - _root.en59._x;
oppside = _Y + ba._y - _root.en59._y;
angle = Math.atan2(- oppside,adjside);
angle = Math.round(angle / 3.141592653589793 * 180);
ba._rotation = 270 - angle;
}
if(shotready == true && inrange == true)
{
_root.bn = _root.bn + 1;
if(_root.bn >= 2000)
{
_root.bn = 1000;
}
shotready = false;
inrange = false;
duplicateMovieClip(_root.t4s,"b" + _root.bn,16384 + _root.bn);
_root["b" + _root.bn]._x = _X;
_root["b" + _root.bn]._y = _Y;
_root["b" + _root.bn]._rotation = ba._rotation;
_root["b" + _root.bn].sound = false;
_root["b" + _root.bn].dmg = dmg;
_root["b" + _root.bn].gotoAndStop(levels);
}
if(shotready == false)
{
tic++;
}
if(tic >= 2)
{
tic = 0;
shotready = true;
}
if(bu.overunit == true)
{
ra.gotoAndStop(1);
}
else if(_root.ts != number && bu.overunit == false || _root.tss == false)
{
ra.gotoAndStop(2);
}
if(bu.clickunit == true)
{
_root.ts = number;
_root.tss = true;
bu.clickunit = false;
}
}